<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "https://www.w3.org/TR/html4/loose.dtd">
<html lang="zh-CN"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta http-equiv="Content-Language" content="zh-CN"><link href="stylesheet.css" media="all" rel="stylesheet" type="text/css">
<title>pg_trigger</title>
<script> var _hmt = _hmt || []; (function() { var hm = document.createElement("script"); hm.src = "https://hm.baidu.com/hm.js?d286c55b63a3c54a1e43d10d4c203e75"; var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(hm, s); })(); </script>
</head><body class="SECT1">
<div>
<table summary="Header navigation table" width="100%" border="0" cellpadding="0" cellspacing="0">
<tr><th colspan="5" align="center" valign="bottom">PostgreSQL 8.2.3 中文文档</th></tr>
<tr><td width="10%" align="left" valign="top"><a href="catalog-pg-tablespace.html" accesskey="P">后退</a></td><td width="10%" align="left" valign="top"><a href="catalogs.html">快退</a></td><td width="60%" align="center" valign="bottom">章43. 系统表</td><td width="10%" align="right" valign="top"><a href="catalogs.html">快进</a></td><td width="10%" align="right" valign="top"><a href="catalog-pg-type.html" accesskey="N">前进</a></td></tr>
</table>
<hr align="LEFT" width="100%"></div>
<div class="SECT1"><h1 class="SECT1"><a name="CATALOG-PG-TRIGGER">43.33. <tt class="STRUCTNAME">pg_trigger</tt></a></h1><a name="AEN64907"></a>
<p><tt class="STRUCTNAME">pg_trigger</tt> 存储表上面的触发器。参阅 <a href="sql-createtrigger.html"><i>CREATE TRIGGER</i></a> 获取更多信息。</p>
<div class="TABLE"><a name="AEN64912"></a>
<p><b>表43-33. <tt class="STRUCTNAME">pg_trigger</tt> 字段</b></p>
<table border="1" class="CALSTABLE"><col><col><col><col>
<thead>
<tr><th>名字</th><th>类型</th><th>引用</th><th>描述</th></tr>
</thead>
<tbody>
<tr><td><tt class="STRUCTFIELD">tgrelid</tt></td><td><tt class="TYPE">oid</tt></td><td><tt class="LITERAL"><a href="catalog-pg-class.html"><tt class="STRUCTNAME">pg_class</tt></a>.oid</tt></td><td>这个触发器所在的表</td></tr>
<tr><td><tt class="STRUCTFIELD">tgname</tt></td><td><tt class="TYPE">name</tt></td><td>&nbsp;</td><td>触发器名称(在同一表的所有触发器中必须唯一)</td></tr>
<tr><td><tt class="STRUCTFIELD">tgfoid</tt></td><td><tt class="TYPE">oid</tt></td><td><tt class="LITERAL"><a href="catalog-pg-proc.html"><tt class="STRUCTNAME">pg_proc</tt></a>.oid</tt></td><td>要调用的函数</td></tr>
<tr><td><tt class="STRUCTFIELD">tgtype</tt></td><td><tt class="TYPE">int2</tt></td><td>&nbsp;</td><td>标识触发器条件的位掩码</td></tr>
<tr><td><tt class="STRUCTFIELD">tgenabled</tt></td><td><tt class="TYPE">bool</tt></td><td>&nbsp;</td><td>如果触发器打开则为真</td></tr>
<tr><td><tt class="STRUCTFIELD">tgisconstraint</tt></td><td><tt class="TYPE">bool</tt></td><td>&nbsp;</td><td>如果触发器实现一个参照完整性约束则为真</td></tr>
<tr><td><tt class="STRUCTFIELD">tgconstrname</tt></td><td><tt class="TYPE">name</tt></td><td>&nbsp;</td><td>参照完整性约束的名称</td></tr>
<tr><td><tt class="STRUCTFIELD">tgconstrrelid</tt></td><td><tt class="TYPE">oid</tt></td><td><tt class="LITERAL"><a href="catalog-pg-class.html"><tt class="STRUCTNAME">pg_class</tt></a>.oid</tt></td><td>一个参照完整性约束引用的表</td></tr>
<tr><td><tt class="STRUCTFIELD">tgdeferrable</tt></td><td><tt class="TYPE">bool</tt></td><td>&nbsp;</td><td>如果可推迟则为真</td></tr>
<tr><td><tt class="STRUCTFIELD">tginitdeferred</tt></td><td><tt class="TYPE">bool</tt></td><td>&nbsp;</td><td>如果是初始可推迟则为真</td></tr>
<tr><td><tt class="STRUCTFIELD">tgnargs</tt></td><td><tt class="TYPE">int2</tt></td><td>&nbsp;</td><td>传递给触发器函数的参数字符串个数</td></tr>
<tr><td><tt class="STRUCTFIELD">tgattr</tt></td><td><tt class="TYPE">int2vector</tt></td><td>&nbsp;</td><td>目前未使用</td></tr>
<tr><td><tt class="STRUCTFIELD">tgargs</tt></td><td><tt class="TYPE">bytea</tt></td><td>&nbsp;</td><td>传递给触发器的参数字符串，每个都是用 NULL 结尾</td></tr>
</tbody>
</table>
</div>
<div class="NOTE">
<blockquote class="NOTE">
<p><b>【注意】</b> <tt class="LITERAL">pg_class.reltriggers</tt> 需要和此表中指定关系上得触发器的个数相等。</p>
</blockquote>
</div>
</div>
<div>
<hr align="LEFT" width="100%">
<table summary="Footer navigation table" width="100%" border="0" cellpadding="0" cellspacing="0">
<tr><td width="33%" align="left" valign="top"><a href="catalog-pg-tablespace.html" accesskey="P">后退</a></td><td width="34%" align="center" valign="top"><a href="index.html" accesskey="H">首页</a></td><td width="33%" align="right" valign="top"><a href="catalog-pg-type.html" accesskey="N">前进</a></td></tr>
<tr><td width="33%" align="left" valign="top"><tt class="STRUCTNAME">pg_tablespace</tt></td><td width="34%" align="center" valign="top"><a href="catalogs.html" accesskey="U">上一级</a></td><td width="33%" align="right" valign="top"><tt class="STRUCTNAME">pg_type</tt></td></tr>
</table>
</div>
</body></html>